home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-28 | 1.5 KB | 70 lines | [TEXT/PJMM] |
- {Compatibility with Think's NewFileName/OldFileName and related calls.}
-
- unit NewOldFile;
-
- interface
- uses
- {$IFC UNDEFINED THINK_PASCAL}
- Types, QuickDraw, Windows, Dialogs, ToolUtils, Events, Controls, {}
- Memory, Sound, OSUtils, MixedMode,
- {$ENDC}
- Messages, Console;
-
- function GetOutFile (prompt, default: Str255): Str255;
- function GetInFile: Str255;
- {$IFC UNDEFINED THINK_PASCAL}
- function NewFileName (prompt: Str255): Str255;
- function OldFileName (prompt: Str255): Str255;
- {$ENDC}
-
- implementation
-
- {NewFileName doesn't work with CodeWarrior!}
- {Copied from pascalcompiler.p!}
- function GetOutFile (prompt, default: Str255): Str255;
- var
- reply: SFReply;
- begin
- SFPutFile(Point(-1), prompt, default, nil, reply);
- if reply.good then
- begin
- if SetVol(nil, reply.vRefNum) <> noErr then
- ; {We ignore errors for now}
- GetOutFile := reply.fName;
- end
- else
- GetOutFile := '';
- end; {GetOutFile}
-
- {$IFC UNDEFINED THINK_PASCAL}
- function NewFileName (prompt: Str255): Str255;
- begin
- NewFileName := GetOutFile(prompt, '');
- end;
-
- function OldFileName (prompt: Str255): Str255;
- var
- reply: SFReply;
- typeList: SFTypeList;
- begin
- typeList[0] := 'TEXT';
- SFGetFile(Point(-1), prompt, nil, 1, @typeList, nil, reply);
- if reply.good then
- begin
- if SetVol(nil, reply.vRefNum) <> noErr then
- ; {We ignore errors for now}
- OldFileName := reply.fName;
- end
- else
- OldFileName := '';
- end; {OldFileName}
- {$ENDC}
-
- function GetInFile: Str255;
- var
- message, count: Integer;
- begin
- GetInFile := OldFileName('');
- end; {GetInFile}
-
- end.